SableCC, an Object-Oriented Compiler Framework

نویسندگان

  • Etienne M. Gagnon
  • Laurie J. Hendren
چکیده

In this thesis, we introduce SableCC, an object-oriented framework that generates compilers (and interpreters) in the Java programming language. This framework is based on two fundamental design decisions. Firstly, the framework uses objectoriented techniques to automatically build a strictly-typed abstract syntax tree that matches the grammar of the compiled language and simpli es debugging. Secondly, the framework generates tree-walker classes using an extended version of the visitor design pattern which enables the implementation of actions on the nodes of the abstract syntax tree using inheritance. These two design decisions lead to a tool that supports a shorter development cycle for constructing compilers. To demonstrate the simplicity of the framework, we discuss the implementation of a state-of-the-art almost linear time points-to analysis. We also provide a brief description of other systems that have been implemented using the SableCC tool. We conclude that the use of object-oriented techniques signi cantly reduces the length of the programmer written code, can shorten the development time and nally, makes the code easier to read and maintain. ii R esum e Dans cette th ese, nous pr esentons SableCC, un environnement orient e-objet qui sert a construire des compilateurs et des interpr eteurs dans le langage de programmation Java. Deux d ecisions fondamentales forment les assises de cet environnement. En premier lieux, l'utilisation de techniques orient ees-objet sert a construire un arbre syntaxique strictement typ e qui est conforme a la syntaxe du langage compil e et qui simpli e le d everminage des programmes. En second lieux, l'environnement g en ere des classes qui traversent l'arbre syntaxique. Ces classes utilisent une version amend ee du mod ele de conception orient e-objet \le visiteur". Ceci permet d'ajouter des actions a ex ecuter sur les noeuds de l'arbre syntaxique en utilisant les techniques d'h eritage objet. Ces deux d ecisions font de SableCC un outil qui permet d'abr eger le cycle de programmation du d eveloppement d'un compilateur. Pour d emontrer la simplicit e de SableCC, nous expliquons les etapes de programmation d'une analyse a la ne pointe des techniques de compilation appel ee \analyse de pointeurs en temps presque lin eaire". De plus, nous d ecrivons bri evement d'autres syst emes qui ont et e bâtis avec SableCC. Nous concluons que l'utilisation de techniques orient ees-objet permet de r eduire substantiellement la quantit e du code ecrit par le programmeur tout en ecourtant possiblement le temps de d eveloppement. Le code s'en trouve plus lisible et facile a maintenir. iii Acknowledgments I cannot thank enough Professor Laurie Hendren, for her technical and nancial support throughout the course of my study at McGill University. She was always there to listen and help. THANKS Laurie. I would like to thanks the students of the fall 1997 edition of the CS-308-621A course that used SableCC and gave me the essential feedback to improve SableCC. Specially, I would like to thank Amar Goudjil for implementing his course project using SableCC, and for all the long discussions that led to many changes in the design of SableCC. I would like to also thank the students of the winter 1998 edition of the CS-308-521B course. More specially, I am thankful to Dmitri Pasyutin, Monica Potlog, Navindra Umanee, Vijay Sundaresan, Youhua Chen and Xiaobo Fan for implementing their object-oriented compiler for the WIG (Web Interface Generator) language using SableCC. I would like to thank them for their help nding and xing a few discrepancies in SalbeCC and testing the framework. I would like to say a special thank to the Sable Research Group members who made a friendly environment to work together, in particular, Raja Vallee-Rai, Fady Habra, Laleh Tajrobehkar, Vijay Sundaresan and Chrislain Raza mahefa. I would like to thank also Zhu Yingchun, Rakesh Ghyia and the unforgettable Christopher Lapkowski of the ACAPS Research Group. Further, I would like to thank my wife Gladys Iodio for her incredible patience and her support in the long hours spent writing this thesis. Without her constant presence, this thesis would not be. iv Dedicated to my wife, Gladys V. Iodio v

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Analysis and Evaluation of Dolittle Error Message for Novices

This paper reports on an analysis and evaluation of error message in Dolittle which is an object-oriented programming language, and is made by SableCC which is a parser generator that generates LALR(1) based parsers in the Java language. Though the Dolittle has a lot of advantages as an educational programming language, its error messaging methodology has some problems in itself, that is, redun...

متن کامل

Object Oriented Compiler Technology

This article describes a new approach to compiler technology. The project in which this approach evolved demands some special properties of compilers, such as language independence and dynamically extensible and orthogonal attributes. These properties cannot be modelled in conventional compiler technology. Therefore, existing technology is tted in an object oriented framework, which is a soluti...

متن کامل

Yes! an Object-oriented Compiler Compiler (yoocc)

Grammar-based processor 1 generation is one of the most widely studied areas in processor con-have been very few approaches to date that reconcile object-oriented principles, processor generation , and an object-oriented language. Pertinent here also, is that currently to develop a processor using the Eiiel Parse libraries requires far too much time to be expended on tasks that can be automated...

متن کامل

A Multi-Formalism Modeling Framework: Formal Definitions, Model Composition and Solution Strategies

In this paper, we present a multi-formalism modeling framework (abbreviated by MFMF) for modeling and simulation. The proposed framework is defined based on the concepts of meta-models and uses object-orientation to overcome the complexities and to enhance the extensibility. The framework can be used as a basis for modeling by various formalisms and to support model composition in a unified man...

متن کامل

Modeling and Evaluation of Stochastic Discrete-Event Systems with RayLang Formalism

In recent years, formal methods have been used as an important tool for performance evaluation and verification of a wide range of systems. In the view points of engineers and practitioners, however, there are still some major difficulties in using formal methods. In this paper, we introduce a new formal modeling language to fill the gaps between object-oriented programming languages (OOPLs) us...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1998